package com.u.social.article.service;

import org.springframework.data.redis.core.RedisCallback;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @program: awesome-spring
 * @description:
 * @author: Alex Wu
 * @createDate: 2025-02-27 16:24
 **/
public interface IRedisService<T> {

    void set(String key, T value);

    void set(String key, T value, long time);

    T get(String key);

    void delete(String key);

    void delete(Collection<String> keys);

    boolean expire(String key, long time);

    Long getExpire(String key);

    boolean hasKey(String key);

    Long increment(String key, long delta);

    Long decrement(String key, long delta);

    void addSet(String key, T value);

    Set<T> getSet(String key);

    void deleteSet(String key, T value);

    T execute(RedisCallback<T> redisCallback);

    void addSortedSet(String key, T value, double score);

    void addList(String key, T value);

    Set<T> getSortedSet(String key, double min, double max);

    List<T> getList(String key, long start, long end);

    void deleteSortedSet(String key, T value);

    void deleteList(String key, T value);

    boolean exists(String key);

    void putHash(String key, String hashKey, T value);

    T getHash(String key, String hashKey);

    Map<Object, Object> getAllHash(String key);

    void deleteHash(String key, String hashKey);

    void incrementHash(String key, String hashKey, long delta);
}
